package com.atguigu.gulimall.product.config;

/**
 * @author ming
 * @create 2022/5/6
 * @description:
 */

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializer;
import org.springframework.session.web.http.CookieSerializer;
import org.springframework.session.web.http.DefaultCookieSerializer;

@Configuration
public class MySessionConfig {
    @Bean
    public CookieSerializer getCookieSerializer(){
        DefaultCookieSerializer cookie = new DefaultCookieSerializer();
        cookie.setCookiePath("/");
        cookie.setDomainName("gulimall.com");
        cookie.setCookieName("GULISESSION");
        return cookie;
    }
    @Bean
     public RedisSerializer<Object> springSesionSerializer(){
         return new GenericJackson2JsonRedisSerializer();
     }

}
